module.exports = app => {
    const mongoose = app.mongoose;
    const Schema = mongoose.Schema;

    const elementsSchema = new Schema({
        name: String,
        type: Number, // 1 背景 2 图片 3 文字 4 形状
        url: String,
        text: String,
        style: String
    });
    const DesignSchema = new Schema({
        tag: Number, // 标签
        elements: [elementsSchema],
        creator: { type: Schema.Types.ObjectId, ref: 'User' }, // 创建者
    }, { timestamps: { createdAt: 'createDate', updatedAt: 'updateDate' } });
    return mongoose.model('Design', DesignSchema);
}